#ifndef DATABASEWINDOW_H
#define DATABASEWINDOW_H

#include <QDialog>
#include <string>
#include <vector>
#include <QString>

namespace Ui {
class DatabaseWindow;
}

class DatabaseWindow : public QDialog {
    Q_OBJECT

   public:
    explicit DatabaseWindow(QWidget *parent = nullptr);
    ~DatabaseWindow();

    // execute mysql sentence, update the log, and return the error code
    int ExecuteAndUpdateLog(const std::string &sentence);
    int ExecuteAndUpdateLog(const QString &sentence);
    int ExecuteAndUpdateLog(const char *sentence);

    void AddNews(const QString &message);

   private slots:
    void on_init_database_clicked();

    void on_in_clicked();

    void on_out_clicked();

    void on_select_item_clicked();

    void on_select_in_clicked();

    void on_select_out_clicked();

    void on_select_log_clicked();

public:
    std::vector<std::vector<std::string>> ans_;

//private:
    Ui::DatabaseWindow *ui;
};

#endif  // DATABASEWINDOW_H
